package solution

func V1(strs []string) string {
	if len(strs) <= 0 {
		return ""
	}

	var (
		idx  = 0
		char byte
		rst  = make([]byte, 0)
	)

	for true {
		char = 0

		for _, str := range strs {
			if idx < len(str) {
				if char == 0 {
					char = str[idx]
				} else {
					if char != str[idx] {
						goto OVER
					}
				}
			} else {
				goto OVER
			}
		}

		rst = append(rst, char)

		idx++
	}

OVER:
	return string(rst)
}
